package com.shengyin.ec.model.entity;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name="clusterCompany")
@DiscriminatorValue("2")
public class ClusterCompany extends Company implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private String logo;
	
	@OneToMany(cascade=CascadeType.ALL,mappedBy="clusterCompany",fetch=FetchType.EAGER)
	private List<Goods> goods;
	
	@OneToMany(mappedBy="clusterCompany")
	private List<ChainCompany> chainCompanys;
	
	@OneToMany(mappedBy="clusterCompany")
	private List<Orders> orders;
	
	public List<Orders> getOrders() {
		return orders;
	}
	public void setOrders(List<Orders> orders) {
		this.orders = orders;
	}
	public String getLogo() {
		return logo;
	}
	public void setLogo(String logo) {
		this.logo = logo;
	}
	public List<Goods> getGoods() {
		return goods;
	}
	public void setGoods(List<Goods> goods) {
		this.goods = goods;
	}
	public List<ChainCompany> getChainCompanys() {
		return chainCompanys;
	}
	public void setChainCompanys(List<ChainCompany> chainCompanys) {
		this.chainCompanys = chainCompanys;
	}
	
	public void addGoods(Goods goods){
		goods.setClusterCompany(this);
		this.goods.add(goods);
	}
	
	
	
}
